package xiaolong.lian.util;

import xiaolong.lian.exception.CustomException;


public class Args {
    public Args ensureNotEmpty(String name, String value) throws CustomException {
        if(isEmpty(value))
            throw new CustomException(name + "不能为空");
        return this;
    }

    public static boolean isEmpty(String value){
        return value == null || value.trim().isEmpty();
    }

    public Args ensureNotEmpty(String name, String[] array) throws CustomException {
        if(isEmpty(array))
            throw new CustomException(name + "不能为空");
        return this;
    }

    public static boolean isEmpty(String[] array){
        return array== null || array.length == 0;
    }
}
